import style from '@/assets/components.module.scss';

import {} from '@/components';
import { HttpResponse } from '@/utils';

export interface ProjectProps {
    children?: string | React.ReactElement | React.ReactElement[];
}

function Project({ children }: ProjectProps) {
    console.log(time().format('{YYYY} HH:mm:ss'), `question render`);

    const id = localStorage.getItem('id');

    const { data } = useSwr<
        HttpResponse<
            {
                pls: { name: string; id: number };
                qus: { title: string; createTime: string };
            }[]
        >
    >(`user?uid=${id}`, axios.get);

    console.log(data);

    return (
        <>
            <div>
                {data?.data.map((item) => (
                    <div key={Math.random()} className={style['questions']}>
                        <div>
                            <p className={style['title']}> {item.qus.title}</p>
                            <p>{item.qus.createTime}</p>
                        </div>
                        <div>{item.pls.name}</div>
                    </div>
                ))}
            </div>
        </>
    );
}

export default Project;
